Drawing coordinate system and scale setting method

ABSTRACT

The invention relates to a method of setting the coordinate system (X D  -Y D ) of a figure drawn on a drawing (DRW) on a tablet surface (8c), and of setting scale. The method includes entering coordinates in a tablet coordinate system (X T  -Y T ) by selecting two points (P 1 , P 2 ) whose coordinates are known in the drawing coordinate system, calculating the distance between the two points in the tablet coordinate system and the distance between the two points in the drawing coordinate system using the abovementioned coordinates and the known coordinates, and obtaining a scale S of the figure based on a ratio of the distances between the two points in both coordinate systems. The drawing coordinate system (X D  -Y D ) is placed upon the tablet surface based on the scale S and the coordinates of the two points (P 1 , P 2 ) in each of the coordinate systems.

DESCRIPTION

1. Technical Field

This invention relates to a method of setting a drawing coordinate system and scale. More particularly, the invention relates to a method of setting the coordinate system and scale of a figure drawn on a drawing set upon a tablet.

2. Background Art

There are cases where a drawing as drawn free hand or the shape of a manufactured article on a drawing which does not include dimensions is defined. In such case, the drawing is placed upon a tablet sensing area of a tablet, the tablet device is made to recognize the scale of the drawing or the drawing coordinate system, (the scale or the drawing coordinate system is set), and then a transformation matrix is obtained for transforming the coordinates of the tablet coordinate system into the coordinates of the drawing coordinate system. Thereafter, the coordinates of points on the drawing are found in the tablet coordinate system, and these coordinates are transformed into those in the drawing coordinate system by the aforementioned transformation matrix. This processing is repeated to define the shape of the manufactured article on the drawing.

The method of setting the scale and the drawing coordinate system will be described with reference to FIG. 6. First, the scale is set by directly entering a drawing scale value "S" from a keyboard. Next, one point P on a drawing DW placed upon a tablet is selected and the coordinates (x₀,y₀) of this point in the drawing coordinate system are entered from the keyboard. After which a point Q on the drawing DW which will render a line segment PQ parallel to or coincident with the X axis of the drawing coordinate system is entered, thereby setting the drawing coordinate system. More specifically, the system uses the initially set scale S to obtain axial distance components S.x₀, S y₀, in the tablet coordinate system X_(T).Y_(T), from the point P to the origin O of the drawing coordinate system. The system thereafter point at distances of S.x₀, S.y₀ from the point P along the respective axes and, regarding this point as being the origin O of the drawing coordinate system, sets the drawing coordinate system on the tablet surface. If S represents the scale, (x₀ ',y₀ ') the coordinates of the origin O in the tablet coordinate system and θ the angle of inclination between the two coordinate systems, then transformation equations for transforming coordinates (x,y) in the tablet coordinate system into coordinates (x',y') in the drawing coordinate system will be as follows: ##EQU1##

    x.sub.0 '=x.sub.1 -(S.x.sub.0. cosθ-y.sub.0.sinθ)(2)

    y.sub.0 '=x.sub.1 -(S.x.sub.0. cosθ+y.sub.0.sinθ)(3)

    θ=tan.sup.-1 (y.sub.2 -y.sub.1)/x.sub.2 -x.sub.1)    (4)

where (x₁,y₁),(x₂,y₂) are the coordinates of points P, Q in the tablet coordinate system X_(T).Y_(T).

However, with the conventional method of setting scale and drawing coordinate system, the setting of scale and the setting of the drawing coordinate system involve two entirely different operations. As a result, the setting procedure is a troublesome one.

In addition, the conventional method cannot be applied unless the X-axis or Y-axis direction on the drawing is already known.

SUMMARY OF THE INVENTION

Accordingly, an object of the present invention is to provide a method in which a drawing coordinate system and scale can be set by one and the same operation, and in which the drawing coordinate system and scale can be set without knowing the directions of axes on the drawing.

The present invention provides a method of setting the coordinate system and scale of a figure drawn on a drawing set upon a tablet.

Coordinates (xt₁,yt₁), (xt₂,yt₂) in a tablet coordinate system are obtained by selecting two points P1, P2 on a drawing, the coordinates of which points in the drawing coordinate system are already known, and the distance between these two points in the tablet coordinate system is calculated. The distance between the two points in the drawing coordinate system is calculated using coordinates (xf₁,yf₁), (xf₂,yf₂) in the drawing coordinate system. A scale S of the drawing is obtained based upon a ratio of the distance between the two points in the drawing coordinate system and the distance between the two points in the tablet coordinate system. The drawing coordinate system is set on the tablet surface based on the scale S and the coordinates of the two point P1, P2 in the drawing coordinate system and in the tablet coordinate system.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an NC unit having an automatic programming function for realizing the present invention;

FIG. 2 is a view for describing the principal portions of a menu chart in the present invention;

FIG. 3 is a view showing a drawing placed upon a tablet surface;

FIG. 4A and FIG. 4B are a flowchart of processing according to the present invention;

FIG. 5 is a view for describing the present invention; and

FIG. 6 is a view for describing a conventional method of setting a coordinate system.

DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 is a block diagram of an NC unit having an automatic programming function for realizing the present invention.

Numeral 1 denotes a processor, 2 a ROM, 3 a RAM for storing defined figure elements as well as the results of processing, 4 an NC data memory for storing created NC data, 5 a keyboard, 6 a disk controller, FL a floppy, 7 a graphic display unit (CRT), and 8 a tablet device.

In the tablet device 8, numeral 8a denotes a tablet surface, 8b a menu chart, 8c a tablet sensing area, and 8d a tablet cursor. The menu chart 8b is affixed to the tablet surface 8a. By using the tablet cursor 8d to select prescribed items written on the menu chart 8b, various items and data can be entered. Further, by moving the tablet cursor 8d on the tablet sensing area 8c and picking a desired point, the selected position can be entered in the tablet coordinate system.

FIG. 2 is a view for describing the principal portions of the menu chart 108b, in which numeral 11 denotes an "EXECUTE" section, 12 a "POINT DEFINITION" section, 13 a "STRAIGHT-LINE DEFINITION" section, and 14 a "CIRCLE DEFINITION" section. CCT in the "EXECUTE" section 11 represents a "COORDINATE SYSTEM SETTING" item.

FIG. 3 is a view showing a drawing DRW of the figure FIG of a manufactured part, which is drawn free hand, placed on the tablet sensing area 8c of the tablet device 8.

FIG. 4 is a flowchart of processing for setting a drawing coordinate system and scale according to the present invention, and FIG. 5 is a view for describing the flowchart. The method of the invention for setting the drawing coordinate system and scale will now be described on the assumption that the drawing DRW (FIG. 3) has been placed upon the tablet sensing area 8c. It is assumed that a system program for executing drawing coordinate systems and scale processing has been stored in the RAM 3 from the floppy FL in advance, and that the drawing coordinate system to be set is a standard coordinate system (right-hand rectangular coordinate system).

First, using the tablet cursor 8d, the operator selects the "COORDINATE SETTING" item CCT from the menu chart 8b shown in FIG. 2 (step 101). As a result, a message for specifying two points of known coordinates in the drawing coordinate system is displayed on the display screen of the graphic display unit 7. Therefore, in response to the message, the operator uses the tablet cursor 8d to select two points P₁, P₂ (see FIG. 5) that are located in the tablet sensing area 8c and whose coordinates is the drawing coordinate system are evident (step 102).

When the points P₁, P₂ have been chosen, the processor 1 obtains coordinates (xt₁,yt₁), (xt₂,yt₂) of these two points in the tablet coordinate system X_(T) -.Y_(T), computes a distance LT between these two points in accordance with the following equation: ##EQU2## and stores the distance in the RAM 3 (step 104).

Next, the operator enters coordinates (xf₁,yf₁), (xf₂,yf₂) of the two points P₁, p₂ in the drawing coordinate system by the keyboard 5 or the like (step 105). As a result, the processor 1 uses the entered coordinates of the two points P₁, P₂ in the drawing coordinate system to calculate a distance LF between the two points in the drawing coordinate system in accordance with the following equation (step 106): ##EQU3## compares the distance LF between the two points in the drawing coordinate system and the distance LT between the two points in the tablet coordinate system, obtains the figure scale

    S=LT/LF

and stores the scale in the RAM 3 (step 107).

When the scale S has been obtained, the processor 1 performs processing for setting the drawing coordinate system based on the scale S and the coordinates of the two points P₁, P₂. More specifically, the processor obtains a circular arc C₁ (see FIG. 5) whose center is the point P₁ and whose radius is S.|xf₂ -xf₁ | (step 108), a circular arc C₂ whose center is the point P₂ and whose radius is S.|yf₂ -yf₁ | (step 109), and a point of intersection Q₁, which is the right-hand intersection of two points of intersection Q₁, Q₂ between the circular arcs C₁, C₂ (step 110). The reason for specifying the right.hand intersection Q₁ is that the orientation of the X axis of a right.hand rectangular coordinate system is on the right-hand side.

Next, the processor obtains S·xf₁, which is found by multiplying the X component xf₁ of point P₁ in the drawing coordinate system by scale S, and obtains a point P₀ found by offsetting point P₁ leftward by a distance of S·xf₁ along the line segment P₁ Q₁ (step 111). A straight line perpendicular to the line segment P₀ Q₁ at point P₀ is adopted as the Y axis of the drawing coordinate system X_(D) -Y_(D) (step 112).

The processor then obtains S·yf₁, which is found by multiplying the Y component yf₁ of point P₁ in the drawing coordinate system by the scale S, obtains a point O found by offsetting point P₀ downward by a distance of S·yf₁ along the Y axis of the drawing coordinate system, adopts the point O as the origin of the drawing coordinate system X_(D) -Y_(D), obtains a straight line perpendicular to the Y axis at point O, and adopts this straight line as the X axis of the drawing coordinate system (step 113).

When the drawing coordinate system has been set, the processor 1 obtains a transformation matrix for transforming coordinates in the tablet coordinate system X_(T) -Y_(T) into coordinates in the drawing coordinate system X_(D) -Y_(D), and stores the matrix in the RAM 3 (step 114). The transformation matrix is obtained as follows: Angles of inclination θ_(T), θ_(D) of the straight line P₁ P₂ in the tablet coordinate system X_(T) -Y_(T) and drawing coordinate system X_(D) -Y_(D) are obtained from the following equations:

    θ.sub.T =tan.sup.-1 (yt.sub.2 -yt.sub.1)/(xt.sub.2 -xt.sub.1)

    θ.sub.D =tan.sup.-1 (yf.sub.2 -yf.sub.1)/(xf.sub.2 -xf.sub.1)

and the angle of inclination θ of the drawing coordinate system with respect to the tablet coordinate system is obtained from the following equation:

    θ=θ.sub.T-θ.sub.D

Accordingly, transformation equations for transforming coordinates (x,y) in the tablet coordinate system into coordinates (x,,y,) in the drawing coordinate system are as follows: ##EQU4##

    X.sub.0 '=xt.sub.1 -(S·xf.sub.1 ·cosθ-S·yf.sub.1 ·sinθ)

    Y.sub.0 '=xt.sub.1 -(S·yf.sub.1 ·cosθ-S·xf.sub.1 ·sinθ)

Next, the scale S (e.g., S=0.5) and the drawing coordinate system X_(D) -Y_(D) are displayed on the display screen (step 115; see 7b in FIG. 1) and the processing for setting the drawing coordinate system and scale is terminated.

Thereafter, the figure FIG of the manufactured article on the drawing DRW is defined by repeating the processing of obtaining coordinates (x,y) of points on the drawing DRW in the table coordinate system X_(T) -X_(T) and transforming these coordinates into coordinates (x',y') in the drawing coordinate system X_(D) -Y_(D) using the transformation matrix obtained above.

Thus, in accordance with the present invention, it is arranged to obtain the coordinates of two points on a figure, the coordinates of which two points are known in a drawing coordinate system, in a tablet coordinate system, calculate the distance between the two points in the tablet coordinate system, calculate the distance between the two points in the drawing coordinate system using keyed.in coordinates of the two points in the drawing coordinate system, obtain a scale of the figure by comparing the distance between the two points in the drawing coordinate system and the distance between the two points in the tablet coordinate system, and set the drawing coordinate system on the drawing based on the scale and the two known points. This makes it possible to define the shape of a manufactured article easily and quickly, as a result of which NC data obtained based upon shape definition data can also be created easily and quickly. 

We claim:
 1. A drawing coordinate system and scale setting method for automatically setting in a tablet device a drawing coordinate system and a scale S of a figure drawn on a drawing placed on a tablet surface having a tablet coordinate system comprising the steps of:(a) obtaining coordinates (x_(t1), y_(t1)), (x_(t2),y_(t2)) in the tablet coordinate system by touching two points P₁ and P₂ on the figure; (b) calculating a distance between said two points in the tablet coordinate system; (c) inputting coordinates (x_(f1),y_(f1)), (x_(f2),y_(f2)) of said two points P₁,P₂ from the drawing coordinate system; (d) calculating a distance between said two points in the drawing coordinate system using the coordinates of said two points P₁, P₂ in the drawing coordinate system; (e) obtaining the scale S of the figure by using the distance between said two points in the drawing coordinate system and the distance between said two points in the tablet coordinate system; (f) obtaining in the table coordinate system a line segment P₁,O₁ being parallel to an X axis of the drawing coordinate system, where O₁ represents a point of intersection between a circle whose center is the point P₁ and whose radius is S * |x_(f2) -x_(f1) |, and a circle whose center is the point P₂ and whose radius is S * |y_(f2) -y_(f1) |; (g) setting in the tablet device coordinates defining a straight line as a Y axis of the drawing coordinate system, which is perpendicular to the line segment P₁ O₁ passing through a point P₀ that is on an extension of line segment P₁ O₁ and located at a distance of S * x_(f1) from the point P₁ ; and (h) setting in the tablet device coordinates defining a point as an origin of the drawing coordinate system which is on the Y axis at a distance of S * y_(f1) from the point P₀ (i) displaying the drawing coordinate system.
 2. A drawing coordinate system and scale setting method according to claim 1, further comprising the steps of:determining an inclination (74 (angle) between the tablet coordinate system and the drawing coordinate system; obtaining a transformation matrix, which is for transforming coordinates in the tablet coordinate system into coordinates in the drawing coordinate system, by using the scale S, said inclination θ, and coordinates of the point P₁ in both of the coordinate systems; obtaining said coordinates of points on the drawing in the tablet coordinate system; and transforming said coordinates of the tablet coordinate system into said coordinates in the drawing coordinate system by said transformation matrix. 